{#
Copyright (c) 2020 Andy Zhou
MIT License
#}
{% extends 'base.html' %}
{% from 'bootstrap/form.html' import render_form %}
{% from 'macros.html' import render_timestamp with context %}
{% block title %} {{ _("Feedback") }} {% endblock title %}
{% block page_content %}
    <h1 class="text-center display-4">
        <strong class="text-primary">
            {{ _("Feedback") }}
        </strong>
    </h1>
    <div class="hello-form" role="form">
        {{ render_form(form, action=request.full_path) }}
    </div>
    <h5 class="d-flex">
        <div class="flex-grow-1">
            {{ feedback|length }} {{ ngettext('feedback', 'feedbacks', __num=feedback|length) }}
        </div>
        <small>
            <a href="#bottom" title="Go Bottom">&darr;</a>
        </small>
    </h5>
    <div class="list-group">
        {% for feedback in feedbacks %}
            {% if feedback.author == current_user %}
            <a class="list-group-item list-group-item-action flex-column">
                <div class="d-flex w-100 justify-content-between">
                    <h5 class="mb-1 text-success">
                        <small class="text-muted"> #{{ loop.revindex }} </small>
                    </h5>
                    <small>
                        {{ render_timestamp(feedback.timestamp) }}
                    </small>
                </div>
                <p class="mb-1"> {{ feedback.body }}</p>
            </a>
            {% endif %}
        {% endfor %}
    </div>
    <div id="bottom"></div>
{% endblock page_content %}
